import grails.converters.JSON
class SiteController {

    def scaffold = Site
    def createSiteService
    def create = {
        redirect(action: "list")
    }

    def createSite = {
        def a = createSiteService.createTeacherSite(params)
        render (a as JSON)
    }

    // 开启和关闭站点
    def goswitch = {
        if (params.id) {
            def site = Site.get(params.id)
            site.enabled = !site.enabled
            site.save(flush: true)
        }
        redirect(action: "list" , controller: "site")
    }
 

}
